package org.myspringframework.test.event;

import org.myspringframework.context.annotation.Component;
import org.myspringframework.context.event.ApplicationListener;

import java.util.Date;

@Component
public class MyEventListener implements ApplicationListener<MyEvent> {

    @Override
    public void onApplicationEvent(MyEvent event) {
        System.out.println("收到：" + event.getSource() + "消息;时间：" + new Date());
        System.out.println("消息：" + event.getId() + ":" + event.getMsg());
    }

}